﻿@using CodeCamp.Models.Schedule
@using CodeCamp.Models.Shared
@using CodeCamp.Infrastructure.Extensions
@model ScheduleBuildingsViewModel
@{
    ViewBag.Title = "";
    string headline;
    if ((@Model != null) && (@Model.EventDisplayName != null))
    {
        ViewBag.Title = @Html.Encode(@Model.EventDisplayName + " | Buildings");
        headline = @Model.EventDisplayName + " Buildings";
    }
    else
    {
        ViewBag.Title = "Code Camp | Buildings";
        headline = "Code Camp Buildings";
    }
}

<h2>@headline</h2>
<h3>(Admin Only)</h3>

@foreach (var building in Model.Buildings)
{
    if (User.IsInRole(CCRoles.RoleNames.BigCheeze))
    {
        @Html.ActionLink("Edit", "EditBuilding", new { eventName = Model.EventShortName, id = building.Id })
    }
    <text> @building.Name<br /></text>
    <text>Rooms:<br /></text>
    foreach (var room in building.Rooms)
    {
        <text>&nbsp;&nbsp;&nbsp;&nbsp;@room.SimpleRoomSummary</text>
        
        if (User.IsInRole(CCRoles.RoleNames.BigCheeze))
        {
            @Html.ActionLink("Edit", "EditRoom", new { eventName = Model.EventShortName, id = room.Id })
        }<br />
    }
    if (User.IsInRole(CCRoles.RoleNames.BigCheeze))
    {
        @Html.ActionLink("Add Room", "AddRoom", new { eventName = Model.EventShortName, id = building.Id })<br />
    }
    <br />
}

@if (User.IsInRole(CCRoles.RoleNames.BigCheeze))
{
    @Html.ActionLink("Add Building", "AddBuilding", new { eventName = Model.EventShortName })<br />
}

@section sidebar {
    @Html.Partial("SidebarCommonPartial")
}
